import React, { Component } from 'react'
import ReactDOM from 'react-dom'
class App extends Component {
  state = { // 初始化定义当前组件的一个状态
    status: false
  }
  render () {
    // <button class="btn btn-success"></button>
    // <button class="btn btn-fail"></button>

    let str = 'btn'
    if (this.state.status) { // 获取初始化的状态
      str += ' btn-success'
    } else {
      str += ' btn-fail'
    }
    return (
      <div className = { str }>
        欢迎来到react的世界
      </div>
    )
  }
}
ReactDOM.render(
  <App />,
  document.getElementById('root')
)